<!-- 模板框架 -->
<template>
    <div class="login_container">
        <div class = "login_box">
           <!--头像标签 -->
            <div class = "avatar_box">
                <img src = "../assets/logo.png" alt="">
            </div>

           <!-- 输入框显示以及遵守的规则  规则-->
            <el-form  ref="loginFormRef"  :rules="loginFormRules"  :model = "loginForm" label-width="0px" class = "login_form">
                <!-- 用户名，规则prop-->
                <el-form-item prop = "username">
                   <el-input v-model = " loginForm.username" prefix-icon="el-icon-user-solid" ></el-input>
                </el-form-item>
                <!-- 密码，规则prop-->
                <el-form-item prop = "password">
                   <el-input v-model = " loginForm.password" prefix-icon="el-icon-lock" type = "password" ></el-input>
                   <!-- 前置图标 -->
                </el-form-item>
                <!-- 按钮-->
                <el-form-item class = "btns">
                   <el-button type="primary">登录</el-button>
                   <el-button type="info" @click = "resetLoginForm">重置</el-button>
                </el-form-item>



            </el-form>

        </div>


       
    </div>
</template>

<!-- 行为 -->
<script>
export default {
    data(){
        return{
           //这是登录表单的数据绑定对象
           //使得输入显示
           loginForm: {
               username:'',
               password:''
           },

            //输入表单应该遵守的规则
           loginFormRules: {
               //验证用户名是否合法
               username:[
                    { required: true, message: '请输入登录名', trigger: 'blur' },
                    { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }
               ],
               //验证密码是否合法
               password:[
                    { required: true, message: '请输入密码', trigger: 'blur' },
               ]
           }

        };

    },
    methods: {
        //点击重置对表单内容进行重置
        resetLoginForm(){
            this.$refs.loginFormRef.resetFields();

        }
    },
    
};
</script>

<!-- 样式 -->
<style lang="less" scoped>
.login_container{
    background-color: #2b4b6b;
    height: 100%;
}
.login_box{
    width: 450px;
    height: 300px;
    background-color: #fff;
    border-radius: 3px;//圆角边框
    position:absolute;//页面位移
    left: 50%;//距离左侧50%
    top:50%;//距离顶部50%
    transform: translate(-50%,-50%);//横轴纵轴移动-50%

    .avatar_box{
        height: 100px;
        width: 100px;
        border:1px solid #eee;//图片边框粗细
        border-radius: 50%;//圆角边框
        box-shadow: 0 0 10px #ddd;//边框阴影
        padding: 10px;//图片与边框间隔
        position: absolute;//向右移动
        left: 50%;//向左移动
        transform:translate(-50%,-50%);
        background-color: #fff;
        img{
            height: 100%;
            width: 100%;
            border-radius: 50%;//图片圆角边框
            background-color: #eee;
        }


}

}

.login_form{
    position: absolute;//位置移动
    bottom: 0;
    width: 100%;
    padding:0 20px;
    box-sizing: border-box;

}
.btns{
    display: flex;
    justify-content: flex-end;//右对齐
}


</style>